import request from '@/utils/request';

interface MessageItem {
  messageId: string;
  title: string;
  email: string;
  messageContent: string;
  createDate: string;
}

interface ListResponse {
  list: MessageItem[];
  total: number;
}

export async function qryMessageListPage(params: {
  pageIndex?: number;
  pageSize?: number;
  param?: {
    title?: string;
  };
}): Promise<ListResponse> {
  const response = await request('/message/qryMessageListPage', {
    method: 'POST',
    data: params,
  });
  return {
    list: response.data || [],
    total: response.total || 0,
  };
}

export async function deleteMessage(params: {
  messageId: string;
}): Promise<void> {
  await request('/message/deleteMessage', {
    method: 'POST',
    data: params,
  });
}
